/* GUI CONVERTED from rcsqrp03.p (converter v1.75) Fri May 25 06:51:29 2001 */
/* rcsqrp03.p - SEQUENCE SCHEDULE PRE-SHIPPER/SHIPPER REPORT                  */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.18 $                                                          */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 9.1            CREATED: 01/01/99  BY: *N003* Steve Nugent        */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00  BY: *N08T* Annasaheb Rahane    */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00  BY: *N0KP* Mark Brown          */
/* REVISION: 9.1      LAST MODIFIED: 09/06/00  BY: *N0RG* Mudit Mehta         */
/* Revision: 1.17      BY: Katie Hilbert     DATE: 04/08/01  ECO: *P008*      */
/* $Revision: 1.18 $   BY: Jean Miller     DATE: 05/25/01  ECO: *N0Z6*      */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */
/*         THIS PROGRAM IS A BOLT-ON TO STANDARD PRODUCT MFG/PRO.           */
/* ANY CHANGES TO THIS PROGRAM MUST BE PLACED ON A SEPARATE ECO THAN        */
/* STANDARD PRODUCT CHANGES.  FAILURE TO DO THIS CAUSES THE BOLT-ON CODE TO */
/* BE COMBINED WITH STANDARD PRODUCT AND RESULTS IN PATCH DELIVERY FAILURES.*/
/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcsqrp03_p_1 "Type"
/* MaxLen: 8 Comment: Indicates Pre-Shipper or Shipper */

&SCOPED-DEFINE rcsqrp03_p_2 "Ship-to!Shipper"
/* MaxLen: 20 Comment: */

&SCOPED-DEFINE rcsqrp03_p_3 "Customer Job!Customer Sequence"
/* MaxLen: 20 Comment: */

&SCOPED-DEFINE rcsqrp03_p_5 "Ship/Delivery Date"
/* MaxLen: 16 Comment: */

&SCOPED-DEFINE rcsqrp03_p_6 "Pre-Shipper/Shipper"
/* MaxLen: 30 Comment: */

&SCOPED-DEFINE rcsqrp03_p_7 "Confirmed"
/* MaxLen: 30 Comment: */

&SCOPED-DEFINE rcsqrp03_p_8 "Ship/Del!Date"
/* MaxLen: 8 Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* LOCAL VARIABLES */
define variable part   like pt_part   no-undo.
define variable part1  like pt_part   no-undo.
define variable sonbr  like so_nbr    no-undo.
define variable sonbr1 like so_nbr    no-undo.
define variable stype  as   character no-undo.
define variable ship like abs_id label {&rcsqrp03_p_6} no-undo.
define variable ship1 like abs_id no-undo.
define variable shipfrom like rcsd_shipfrom no-undo.
define variable shipfrom1 like abs_shipfrom no-undo.
define variable shipto like rcsd_shipto no-undo.
define variable shipto1 like abs_shipto no-undo.
define variable range as character no-undo.
define variable range1 as character no-undo.
define variable custjob_from like rcsd_cust_job no-undo.
define variable custjob_to like rcsd_cust_job no-undo.
define variable seq like rcsd_cust_seq no-undo.
define variable seq1 like rcsd_cust_seq no-undo.
define variable ref like rcsd_cust_ref no-undo.
define variable ref1 like rcsd_cust_ref no-undo.
define variable status_from like rcsd_status no-undo.
define variable status_to like rcsd_status no-undo.
define variable date like rcsd_date no-undo.
define variable date1 like rcsd_date no-undo.
define variable l_time like rcsd_time no-undo.
define variable l_time1 like rcsd_time no-undo.
define variable l_site like si_site no-undo.
define variable shp_stat as logical label {&rcsqrp03_p_7} no-undo.
define variable pick_ship as logical format {&rcsqrp03_p_6}
   label {&rcsqrp03_p_6} initial true no-undo.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
shipfrom      colon 25
   shipfrom1     colon 52 label {t001.i}
   shipto        colon 25
   shipto1       colon 52 label {t001.i}
   ship          colon 25
   ship1         colon 52 label {t001.i}
   part          colon 25
   part1         colon 52 label {t001.i}
   custjob_from  colon 25 view-as fill-in size 20 by 1
   custjob_to    colon 52 label {t001.i} view-as fill-in size 20 by 1
   seq           colon 25 view-as fill-in size 20 by 1
   seq1          colon 52 label {t001.i} view-as fill-in size 20 by 1
   ref           colon 25 view-as fill-in size 20 by 1
   ref1          colon 52 label {t001.i} view-as fill-in size 20 by 1
   date          colon 25 label {&rcsqrp03_p_5}
   l_time        no-label
   date1         colon 52 label {t001.i}
   l_time1       no-label
   status_from   colon 25
   status_to     colon 52 label {t001.i}
   sonbr         colon 25
   sonbr1        colon 52 label {t001.i}
   skip (1)
   pick_ship     colon 43
   shp_stat      colon 43
with frame a side-labels width 80 NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

FORM /*GUI*/ 
   stype          column-label {&rcsqrp03_p_1}
   rcsd_shipto    column-label {&rcsqrp03_p_2}
                  format "x(20)"
   abss_confirmed
   rcsd_cust_job  column-label {&rcsqrp03_p_3}
   l_site
   rcsd_part
   rcsd_discr_qty
   pt_um
   rcsd_date      column-label {&rcsqrp03_p_8}
   rcsd_status
with STREAM-IO /*GUI*/  frame c down width 132 no-box.

/* SET EXTERNAL LABELS */
setFrameLabels(frame c:handle).

{wbrp01.i}

repeat:

   /* RESET THE HIGH VALUES */
   if ship1 = hi_char then ship1 = "".
   if shipto1 = hi_char then shipto1 = "".
   if shipfrom1 = hi_char then shipfrom1 = "".
   if part1 = hi_char then part1 = "".
   if sonbr1 = hi_char then sonbr1 = "".
   if custjob_to = hi_char then custjob_to = "".
   if seq1 = hi_char then seq1 = "".
   if ref1 = hi_char then ref1 = "".
   if status_to = hi_char then status_to = "".
   if date = low_date then date = ?.
   if date1 = hi_date then date1 = ?.
   if l_time1 = hi_char then l_time1 = "".

   if c-application-mode <> 'WEB' then
   update
      shipfrom shipfrom1
      shipto shipto1
      ship ship1
      part part1
      custjob_from custjob_to
      seq seq1
      ref ref1
      date l_time date1 l_time1
      status_from status_to
      sonbr sonbr1
      pick_ship
      shp_stat
   with frame a.

   {wbrp06.i &command = update
      &fields = "shipfrom shipfrom1 shipto shipto1
                 ship ship1 part part1 custjob_from custjob_to
                 seq seq1 ref ref1 date l_time date1 l_time1
                 status_from status_to sonbr sonbr1
                 pick_ship shp_stat "
      &frm = "a"}

   if (c-application-mode <> 'WEB')  or
      (c-application-mode = 'WEB' and
      (c-web-request begins 'DATA'))
   then do:

      /* SETUP BATCH PARAMS */
      bcdparm = "".
      {mfquoter.i shipfrom}
      {mfquoter.i shipfrom1}
      {mfquoter.i shipto }
      {mfquoter.i shipto1}
      {mfquoter.i ship }
      {mfquoter.i ship1}
      {mfquoter.i custjob_from}
      {mfquoter.i custjob_to}
      {mfquoter.i seq}
      {mfquoter.i seq1}
      {mfquoter.i ref}
      {mfquoter.i ref1}
      {mfquoter.i status_from}
      {mfquoter.i status_to}
      {mfquoter.i date}
      {mfquoter.i l_time}
      {mfquoter.i date1}
      {mfquoter.i l_time1}
      {mfquoter.i part }
      {mfquoter.i part1}
      {mfquoter.i sonbr }
      {mfquoter.i sonbr1}
      {mfquoter.i pick_ship}
      {mfquoter.i shp_stat}
   end.

   /* SET THE HIGH VALUES */
   if shipfrom1 = "" then shipfrom1 = hi_char.
   if shipto1 = "" then shipto1 = hi_char.
   if ship1 = "" then ship1 = hi_char.
   if part1 = "" then part1 = hi_char.
   if sonbr1 = "" then sonbr1 = hi_char.
   if custjob_to = "" then custjob_to = hi_char.
   if seq1 = "" then seq1 = hi_char.
   if ref1 = "" then ref1 = hi_char.
   if status_to = "" then status_to = hi_char.
   if date = ? then date = low_date.
   if date1 = ? then date1 = hi_date.
   if l_time1 = "" then l_time1 = hi_char.

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "printer"
               &printWidth = 132
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "yes"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
/*GUI*/ RECT-FRAME:HEIGHT-PIXELS in frame a = FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.


   {mfphead.i}

   /* SET THE DOCUMENT ID SELECTION RANGES */
   if pick_ship then
   assign
      stype = caps(getTermLabel("PRE-SHIPPER",8))
      range = "p" + ship
      range1 = "p" + ship1.
   else
   assign
      stype = caps(getTermLabel("SHIPPER",8))
      range = "s" + ship
      range1 = "s" + ship1.

   SHIPLOOP:
   for each abss_det where
         abss_shipfrom >= shipfrom and abss_shipfrom <= shipfrom1
         and abss_shipto >= shipto and abss_shipto <= shipto1
         and abss_part >= part and abss_part <= part1
         and abss_cust_job >= custjob_from and
         abss_cust_job <= custjob_to
         and abss_cust_seq >= seq and abss_cust_seq <= seq1
         and abss_cust_ref >= ref and abss_cust_ref <= ref1
         and abss_status >= status_from and abss_status <= status_to
         and abss_date >= date and abss_date <= date1
         and abss_time >= l_time and abss_time <= l_time1
         and abss_ship_id >= range and abss_ship_id <= range1
   use-index abss_index4
   no-lock
   break by abss_cust_job
         by abss_cust_seq
         by abss_cust_ref:

      if (shp_stat and not abss_confirmed) or
         (not shp_stat and abss_confirmed)
      then next SHIPLOOP.

      for each rcsd_det where
            rcsd_shipfrom = abss_shipfrom  and
            rcsd_shipto = abss_shipto      and
            rcsd_rlse_id = abss_rlse_id    and
            rcsd_cust_job = abss_cust_job  and
            rcsd_cust_seq = abss_cust_seq  and
            rcsd_cust_ref = abss_cust_ref  and
            rcsd_date = abss_date          and
            rcsd_time = abss_time          and
            (rcsd_order >= sonbr and rcsd_order <= sonbr1) and
            rcsd_part = abss_part
      no-lock:

         for first pt_mstr where pt_part = rcsd_part no-lock:
         end.

         display
            stype
            rcsd_shipto
            rcsd_cust_job
            rcsd_shipfrom @ l_site
            rcsd_part
            rcsd_discr_qty
            pt_um    when (available pt_mstr)
            rcsd_date
            rcsd_status
            abss_confirmed
         with frame c STREAM-IO /*GUI*/ .

         down 1 with frame c.

         display
            substring(abss_ship_id,2,20) @ rcsd_shipto
            rcsd_cust_seq @ rcsd_cust_job
            rcsd_time     @ rcsd_date
         with frame c STREAM-IO /*GUI*/ .

         down 2 with frame c.

         
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

      end. /* for each rcsd_det */
   end. /* SHIPLOOP */
   {mfrtrail.i}
end. /* repeat */

{wbrp04.i &frame-spec = a}
